import Vue from 'vue'
import Router from 'vue-router'
import {
  resolve
} from 'url'

Vue.use(Router)
export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [{
      path: '/register',
      component: resolve => {
        require(['./views/register/register.vue'], resolve)
      }
    },
    {
      path: '/login',
      component: resolve => {
        require(['./views/register/login.vue'], resolve)
      }
    },
    {
      path: '/forget',
      component: resolve => {
        require(['./views/register/forget.vue'], resolve)
      }
    },
    {
      path: '/home',
      component: resolve => {
        require(['./views/home.vue'], resolve)
      },
      children: [{
          path: '/home',
          component: resolve => {
            require(['./views/homes.vue'], resolve)
          }
        },
        {
          // path: '/home/about',
          path: '/home/1',
          component: resolve => {
            require(['./views/home/index.vue'], resolve)
          },
          children: [{
              // path: '/home/about/ourselves', //关于我们
              path: '/home/about/1',
              component: resolve => {
                require(['./views/home/ourselves.vue'], resolve)
              }
            },
            {
              // path: '/home/about/companyflow', //企业招聘流程
              path: '/home/about/2',
              component: resolve => {
                require(['./views/home/companyflow.vue'], resolve)
              }
            },
            {
              // path: '/home/about/enterprise', //企业用户服务协议
              path: '/home/about/3',
              component: resolve => {
                require(['./views/home/enterprise.vue'], resolve)
              }
            },
            {
              // path: '/home/about/privacy', //隐私政策
              path: '/home/about/4',
              component: resolve => {
                require(['./views/home/privacy.vue'], resolve)
              }
            },
            {
              // path: '/home/about/talents', //人才使用流程
              path: '/home/about/5',
              component: resolve => {
                require(['./views/home/talents.vue'], resolve)
              }
            },
            {
              // path: '/home/about/personal', //个人用户服务协议
              path: '/home/about/6',
              component: resolve => {
                require(['./views/home/personal.vue'], resolve)
              }
            },
            {
              // path: '/home/about/problem', //常见问题
              path: '/home/about/7',
              component: resolve => {
                require(['./views/home/problem.vue'], resolve)
              }
            },
            {
              // path: '/home/about/antifraud', //防骗指南
              path: '/home/about/8',
              component: resolve => {
                require(['./views/home/antifraud.vue'], resolve)
              }
            }
          ]
        }
      ]
    },
    {
      path: '/',
      component: resolve => {
        require(['./views/index.vue'], resolve)
      },
      children: [{
          path: '/index', //主页
          component: resolve => {
            require(['./views/index/index.vue'], resolve)
          }
        },
        {
          path: '/resume', //简历页所有职位
          component: resolve => {
            require(['./views/resume/index.vue'], resolve)
          }
        },
        {
          path: '/communication', //沟通页
          component: resolve => {
            require(['./views/communication/index.vue'], resolve)
          },
          children: [{
              path: '/communication/OnlineResume', //在线简历
              component: resolve => {
                require([
                  './views/communication/OnlineResume/OnlineResume.vue'
                ], resolve)
              }
            },
            {
              path: '/communication/chatWindow', //聊天窗口
              component: resolve => {
                require([
                  './views/communication/chatWindow/chatWindow.vue'
                ], resolve)
              }
            },
            {
              path: '/communication/report', //聊天窗口
              component: resolve => {
                require(['./views/communication/report/report.vue'], resolve)
              }
            }
          ]
        },
        // 沟通页-企业顾问
        {
          path: '/communication/Corporate',
          component: resolve => {
            require(['./views/Corporate/Corporate.vue'], resolve)
          }
        },
        {
          path: '/job',
          component: resolve => {
            //职位管理页
            require(['./views/job/index.vue'], resolve)
          }
        },
        {
          path: '/personal', //个人中心页
          component: resolve => {
            require(['./views/personal/index.vue'], resolve)
          }
        },
        {
          path: '/postjob', //发布职位页
          component: resolve => {
            require(['./views/postJob/index.vue'], resolve)
          }
        },
        {
          path: '/editjob', //编辑职位页
          component: resolve => {
            require(['./views/postJob/index.vue'], resolve)
          }
        },
        {
          path: '/setting',
          component: resolve => {
            require(['./views/setting/index.vue'], resolve)
          },
          children: [{
              path: '/setting/binding',
              component: resolve => {
                require(['./views/setting/binding.vue'], resolve)
              }
            },
            {
              path: '/setting/company',
              component: resolve => {
                require(['./views/setting/companyInfo.vue'], resolve)
              }
            },
            {
              path: '/setting/bindemail',
              component: resolve => {
                require(['./views/setting/bindEmail.vue'], resolve)
              }
            },
            {
              path: '/setting/personal',
              component: resolve => {
                require(['./views/setting/personalInfo.vue'], resolve)
              }
            },
            {
              path: '/setting/password',
              component: resolve => {
                require(['./views/setting/password.vue'], resolve)
              }
            },
            {
              path: '/setting/privacy',
              component: resolve => {
                require(['./views/setting/privacy.vue'], resolve)
              }
            },
            {
              path: '/setting/bank',
              component: resolve => {
                require(['./views/setting/bank.vue'], resolve)
              }
            }
          ]
        },
        {
          path: '/about',
          component: resolve => {
            require(['./views/about/index.vue'], resolve)
          },
          children: [{
              path: '/about/1', //关于我们
              component: resolve => {
                require(['./views/about/ourselves.vue'], resolve)
              }
            },
            {
              path: '/about/2', //企业招聘流程
              component: resolve => {
                require(['./views/about/companyflow.vue'], resolve)
              }
            },
            {
              path: '/about/3', //企业用户服务协议
              component: resolve => {
                require(['./views/about/enterprise.vue'], resolve)
              }
            },
            {
              path: '/about/4', //隐私政策
              component: resolve => {
                require(['./views/about/privacy.vue'], resolve)
              }
            },
            {
              path: '/about/5', //人才使用流程
              component: resolve => {
                require(['./views/about/talents.vue'], resolve)
              }
            },
            {
              path: '/about/6', //个人用户服务协议
              component: resolve => {
                require(['./views/about/personal.vue'], resolve)
              }
            },

            {
              path: '/about/7', //常见问题
              component: resolve => {
                require(['./views/about/problem.vue'], resolve)
              }
            },
            {
              path: '/about/8', //防骗指南
              component: resolve => {
                require(['./views/about/antifraud.vue'], resolve)
              }
            }
          ]
        }
      ]
    },
    {
      path: '*',
      component: resolve => {
        require(['./views/error.vue'], resolve)
      }
    }
  ]
})